package com.ruoyi.web.controller.warning;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.domain.R;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.warning.domain.entity.Wirelessoids;
import com.ruoyi.warning.domain.query.WirelessoidsQuery;
import com.ruoyi.warning.service.IWirelessoidsService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

/**
 * <p>
 * 无线oid表 前端控制器
 * </p>
 *
 * @author chenhc
 * @since 2025-07-08
 */
@RestController
@RequestMapping("/wirelessoids")
@Api(tags = "无线oid表", description = "用于处理无线oid相关操作的控制器")
public class WirelessoidsController {
    @Resource
    private IWirelessoidsService wirelessoidsService;

    @ApiOperation("列表")
    @Log(title = "查询列表", businessType = BusinessType.SELECT)
    //@PreAuthorize("@ss.hasPermi('system:config:export')")
    @GetMapping(value = "/list")
    public R list(WirelessoidsQuery query)
    {
        LambdaQueryWrapper<Wirelessoids> wrapper = new QueryWrapper<Wirelessoids>().lambda()
                .eq(Wirelessoids::getDeviceId, query.getDeviceId());
        return R.ok(wirelessoidsService.list(wrapper));
    }

    @ApiOperation("新增或修改")
    @Log(title = "新增或修改", businessType = BusinessType.UPDATE)
    //@PreAuthorize("@ss.hasPermi('system:config:export')")
    @PostMapping(value = "/saveOrUpdate")
    public R saveOrUpdate(@RequestBody List<Wirelessoids> list)
    {
        return R.ok(wirelessoidsService.saveOrUpdateBatch(list));
    }
}
